package com.murray.assignment.utils;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118605213";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCjlZCvnIbxQCRsS9V/4vJabU5onJHm8mqya9o6yIhFqaqLCvtAh5F5OUeMfo0JKBbmFQcOqAwC60bjLNPx4ABWQPrB7+wnOL7He/T7BXGQlwilmid97Z6KhSOlqQngIFVmFeTMYVsb5LZp1oTr7I+mRQzfk8H4UP6Rn3ASWRXT/uPltmhVGoYv55FvlKJM20vwPRNYQpgI8HvAO7X66reSbkPIsFGjQxGmXQEwAG4yhHjC7/ShLZlXwk2qcI2jjugvSiSFo/JzKVD+Am1LJO8CLeykDtXEvLRJWchRAkNZAfRWyJFdsoAs8dXXCxm/pdwBiUTY81mXdedZMsNiGYBLAgMBAAECggEBAKAHpEi4FycR+c/cDBwU98RQ5IDgkrdc9dZgPlh9bxq/VbC6aHuDZGQ0DfO6pdyMVIJ3lbTX3xBH/MwnQZyA57N51BY/0UW5dKGQeWPMuoGZz4K6IOJHwG6AuxPIH3ocB49b4b2zjD7oay91BgoLHaiqKmLamMqE6dWqJSg98GW3hozrEr0uyFGl6qr50XeNCEQEZCYRLOAQcFTiwKwv2nvYMQHHJ/mCKxE1RL+3QIeNpggljhxOI5yiESTi8Wr5UUfan+M59jC2YeVVjw8xI8C/xLZSlEX46JLhlAf1WD0rKZn7XLNjXcaMFdk0vuBIjYGnWZU90kb26wMZ3Y5u/ZkCgYEA3oTvm8ISG+Yhfc7Xbi/5qOR6Zj5uJ38bLFsqSk+xK/J6noA9VzhWRn50wwJr3JmI9zO8SOxn15WvP5kxenjEhqguI0hS7tWgVcvpFrj6Med+IL4ysWQArVMwpyAC536HM1a991OYsJ+F30lQt45AaH4wVHys9oHox9Gu3nv32D8CgYEAvDKNOuoc79vOlJSkejpAZPKHxoe49t9NE7weNjYjLZ+9zSH9BwZWh1Fy0YGIOLgjg1tmIfIouv61asu7lv2gmgoQA9n8BL4gkzyDx9kTsxgoNsnunHGUe5q90MNkvTABw7Ll0/I7DzRS14Tt4Vw9Ksz2RrKYz7qtzjiI/51VdPUCgYEAn9oP52z7ZV9lH+O/j0CXsWSxKVIf/++nra2wK8IkHNYMkGC/sDCgifO+HXlX0xnY8v0PfbOWxaCaTK3YhYrMY4/d1SrXqQt+KyRZRiGMWt1aFluMPzL/6YOhp+2vKG4U4iSmQ06imf9/RHB+s95VFrvQLGGEP3IDr8hKPzn/SjECgYByCa/Ko1IlhewH3IpOBj4+7TeY9WT/MxBhhPxJnURzwPgh9RZ9yzljhdctXHBO7kWWsyuQJkzIAs+rhwiE1esbbD2IF+6+cPcMQP8ZelCVlW3IxVPxOGHhBENA3SWN/ikTjLP3WjCvZeVM8x+yD1KBPPF+pXozZcsrytY5Df1agQKBgAdeDKQchkPWodfJKOQyJRXQe1AvT7Dz7jrHV6f9Zz9q3asZAOhI/C9tfi5FRyqIqL12Sn79aIfxkZU7QUO6PNfz25KjvPZ4dfpPGSRpK69lfaprUBggKOHSRWCvg8IJkF3AKMTwsn89orYej4WS/b8CZO7LS8qBR4lmFPg1bfwr";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq3N7+iKJvdsH+Jqwv4jqI7XTlH77EBwn10v2eBPaz8t6XqirLV3IpIh+MO3t7A50mbrxW0wI1qTQRqXO2fdlAt7kdmTwjcr+2dXPo6uNyf0yLULh1ma7yjabWiCfbdBM9mLOo8KHQkKbP64De+y84HLw1tDFcbiN35Cvab7qhwYuB47Kti/s3eDkBxmBMNMQFAeZXdPgLSNV4+DNleh/bkUlWzP31Qm/nzDtCgkfcDPgLypfRAXW2Coce76bgGJUnrM1IBeAbMpr8pKovoLHaCrcmr+gUvdUaNaSsHygE3CFJKVBqvsoT3X1pebcn2gkOc5C4FNP2Qc4+hDHGPOpvQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	//支付宝支付成功后，将结果返回给商户指定路径
    public static String notify_url = "http://localhost:8080/Shop_war_exploded/pay/notifyUrl";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	//支付成功后跳转到商户页面
    public static String return_url = "http://localhost:8080/Shop_war_exploded/pay/returnUrl";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "E:/";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

